home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 46 / Amiga Format CD46 (1999-10-20)(Future Publishing)(GB)[!][issue 1999-12].iso / -in_the_mag- / reader_requests / scilab / demos / bike / macros / velo1.sci < prev    next >
Text File  |  1999-09-16  |  1KB  |  37 lines

  1. function []=velo1()
  2. // "full wheel" version
  3. ct=-cos(t);cp=cos(p);st=-sin(t);sp=sin(p);
  4.   xe=[xmin;xmax;xmax;xmin;xmin]
  5.   ye=[ymin;ymin;ymax;ymax;ymin]
  6.   ze=[zmin;zmin;zmin;zmin;zmin];
  7.   xer=ct*xe-st*ye;
  8.   yer=cp*(st*xe+ct*ye)+sp*ze;
  9.   isoview(mini(xer),maxi(xer),mini(yer),maxi(yer));
  10.   xpoly(xer,yer,'lines')
  11.  
  12. [n1,n2]=size(xfrontar);
  13. xset("alufunction",6)
  14. deff('[]=velod(i)',['xnr=ct*xfrontar(:,i)-st*yfrontar(:,i);';
  15.       'ynr=cp*(st*xfrontar(:,i)+ct*yfrontar(:,i))+sp*zfrontar(:,i);';
  16.       'xnt=ct*xf(:,i)-st*yf(:,i);';
  17.       'ynt=cp*(st*xf(:,i)+ct*yf(:,i))+sp*zf(:,i);';
  18.       'xnf=ct*xrearar(:,i)-st*yrearar(:,i),';
  19.       'ynf=cp*(st*xrearar(:,i)+ct*yrearar(:,i))+sp*zrearar(:,i);';
  20.       'xpoly(xnt,ynt,''lines'')';
  21.       'xfpoly(xnr,ynr)';
  22.       'xfpoly(xnf,ynf)']);
  23. comp(velod);
  24.  
  25. xset('thickness',2); 
  26. for i=1:n2-1,velod(i);ww=i:i+1;
  27. plot2d((ct*xprear(1,ww)-st*xprear(2,ww))',...
  28.      (cp*(st*xprear(1,ww)+ct*xprear(2,ww))+sp*xprear(3,ww))',...
  29.      [-1,1],"000");
  30. velod(i);
  31. end
  32. velod(n2-1);
  33. xset("alufunction",3);
  34. xset('thickness',1);
  35.  
  36.  
  37.